#include "phoneloginwidget.h"

#include <QVBoxLayout>

phoneLoginWidget::phoneLoginWidget(QWidget *parent)
    : QWidget{parent}
    , mainLayout(new QVBoxLayout(this))
    , returnButton(new QToolButton())
    , stackWidget(new QStackedWidget())
    , pwdLoginWidget(new phonePwdLoginWidget())
{
    setMinimumSize(QSize(400, 670));
    setMaximumSize(QSize(400, 670));
    QHBoxLayout *returnLayout = new QHBoxLayout();
    returnLayout->setObjectName("returnLayout");
    returnLayout->setAlignment(Qt::AlignLeft);

    returnButton->setObjectName("returnButton");
    returnButton->setIcon(QIcon(":/resources/left-arrow.png"));
    returnButton->setStyleSheet("QToolButton{border:none;}");
    returnLayout->addWidget(returnButton);

    mainLayout->addLayout(returnLayout);
    stackWidget->addWidget(pwdLoginWidget);

    stackWidget->setCurrentIndex(0);

    mainLayout->addWidget(stackWidget);
    connect(returnButton, &QToolButton::clicked, this, &phoneLoginWidget::onReturnButtonClicked);
}

void phoneLoginWidget::onReturnButtonClicked()
{
    emit returnMainLoginWidget();
}
